#include "Bullet.h"
#include "GlobalDefine.h"

CBullet::CBullet(hgeSprite* sprite)
:m_BulletSprite(sprite)
{
	m_Type = TYPE_BULLET;
}

CBullet::CBullet(float speed, float x, float y, int direction, hgeSprite* sprite)
:m_BulletSprite(sprite)
{
	Shoot(speed,direction,x,y);
	m_Type = TYPE_BULLET;
}

CBullet::~CBullet(void)
{
}

bool CBullet::Shoot(float speed, int direction, float x, float y)
{
	if(m_BulletSprite)
	{
		m_Speed = speed;
		m_Direction = direction;
		float w = m_BulletSprite->GetWidth();
		float h = m_BulletSprite->GetHeight();
		SetRect(x,y,w,h);
		return true;
	}
	return false;
	
}

void CBullet::DoRender()
{
	if(m_BulletSprite)
		m_BulletSprite->Render(GetX(),GetY());
}